ser  = []
for i in range(2, 1000):
    f = 1
    for j in range(2, i//2):
        if i%j==0:
            f = 0
            break
    if f:
        ser.append(i)








am = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']
x = input().replace('9', '&').replace('8', '&').replace('7', '&').replace('6', '&')\
     .replace('5', '&').replace('4', '&').replace('3', '&').replace('2', '&')\
     .replace('1', '&').replace('0', '&')
if not(len(x.split())==3) or "&" in x:
    print('Wrong input')

else:
    y = ch.split()
    new = ''
    for i in y:
        new += str(am.index(i))
    gm = int(new)

z = []
for i in ser:
    z.append([abs(gm - i), i])

print(sorted(z)[0][1])
    
